﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AutoIt_IDE.Core;

namespace AutoIt_Elements.GUI.Controls
{
	public partial class ModuleHost : Control
	{
		private GuiModuleBase _HostedModule = null;

		public ModuleHost()
		{
			InitializeComponent();
			this.DoubleBuffered = true;
			this.ResizeRedraw = true;
		}

		private void SetHostedModule(GuiModuleBase HostedModule)
		{
			if(((HostedModule != null) && HostedModule.IsStarted) || (HostedModule == null))
			{
				this._HostedModule = HostedModule;
			}
			if(this._HostedModule != null)
				((Control)this._HostedModule).Dock = DockStyle.Fill;
			this.Invalidate();
		}

		protected override void OnPaint(PaintEventArgs pe)
		{
			base.OnPaint(pe);
			if(this._HostedModule != null)
				((Control)this._HostedModule).Invalidate();
		}
	}
}
